import Mock from './mock.angular';

Mock.mock('/api/v1/device/add', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/deviceInOut/add', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/device/delete', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/device/update', 'post', {
  success: true,
  message: '',
  code: 200,
});


Mock.mock('/api/v1/device/get', 'get', {
  success: true,
  message: '',
  code: 200,
  data: {
    deviceName: '@cname',
    deviceTypeCode: '@id',
    model: '@word',
    useLocationName: '@word',
    'catgegroy|1': [1, 2, 3, 4],
    'isRent|1': [1, 2],
    inTime: '@date',
    operatorNames: '@word',
    'acceptStatus|1': [1, 2],
    outTime: '@date',
    remark: '@word',
    'files|2-5': [
      {
        'type|1': [1, 2],
        id: '@id',
        fileName: '@cname',
      },
    ],
  },
});

Mock.mock('/api/v1/device/query', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        deviceName: '@cname',
        code: '@id',
        'catgegroy|1': [1, 2, 3, 4],
        inTime: '@date',
        useLocationName: '@word',
      },
    ],
  };
  return Mock.mock(respData);
}));

Mock.mock('/api/v1/deviceCheck/query', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        checkTime: '@date',
        'checkResult|1': [1, 2],
        nextCheckTime: '@date',
        'files|2-5': [
          {
            'type|1': [1, 2],
            id: '@id',
            fileName: '@cname',
          },
        ],
      },
    ],
  };
  return Mock.mock(respData);
}));

Mock.mock('/api/v1/deviceCheck/delete', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/deviceCheck/update', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/deviceMaintain/query', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        maintainTime: '@date',
        maintainContent: '@word',
        nextMaintainTime: '@date',
        'files|2-5': [
          {
            'type|1': [1, 2],
            id: '@id',
            fileName: '@cname',
          },
        ],
      },
    ],
  };
  return Mock.mock(respData);
}));

Mock.mock('/api/v1/deviceMaintain/delete', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/deviceMaintain/update', 'post', {
  success: true,
  message: '',
  code: 200,
});


Mock.mock('/api/v1/device/document/query', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        documentNumber: '@id',
        documentName: '@word',
        compileTime: '@date',
        'attachmentId|2': [1, 2, 3],
      },
    ],
  };
  return Mock.mock(respData);
}));

Mock.mock('/api/v1/device/document/delete', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/device/document/update', 'patch', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/deviceCheck/query', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        checkTime: '@date',
        'checkResult|1': [1, 2],
        nextCheckTime: '@date',
        'files|2-5': [
          {
            'type|1': [1, 2],
            id: '@id',
            fileName: '@cname',
          },
        ],
      },
    ],
  };
  return Mock.mock(respData);
}));

Mock.mock('/api/v1/deviceCheck/delete', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/deviceCheck/update', 'post', {
  success: true,
  message: '',
  code: 200,
});

Mock.mock('/api/v1/deviceInOut/query', 'post', (({ data }) => {
  const respData = {
    success: true,
    message: '',
    code: 200,
    page: data.page,
    total() {
      return this.rows.length;
    },
    'rows|20-100': [
      {
        id: '@id',
        'type|1': [1, 2],
        recordTime: '@date',
      },
    ],
  };
  return Mock.mock(respData);
}));
